﻿<UserControl x:Class="DiscoveryLogic.Analytics.Modules.DataNavigation.EntityNavigator"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<DockPanel LastChildFill="True">
		<Border 
			DockPanel.Dock="Top" 
			BorderBrush="Gray" 
			BorderThickness="1,0,1,1">
			<Border.Background>
				<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
					<GradientStop Color="#33000000" Offset="0" />
					<GradientStop Color="#11000000" Offset="1" />
				</LinearGradientBrush>
			</Border.Background>
			<StackPanel Orientation="Horizontal" Margin="6">
                <TextBox 
					  x:Name="searchTextBox"
					  KeyDown="searchTextBox_KeyDown" 
					  Margin="6,0"
					  Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
					  Width="Auto" MinWidth="120" HorizontalAlignment="Stretch"/>
                <Button 
					Command="{Binding SearchCommand}" 
					Content="_Find" 
					Padding="6,0"/>
			</StackPanel>
		</Border>
		
		<TreeView 
			ItemsSource="{Binding FirstGeneration}" 
            Width="Auto" Height="Auto" MinWidth="150" MinHeight="200"
			HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <TreeView.Resources>
                <ResourceDictionary>
                    <ResourceDictionary.MergedDictionaries>
                        <ResourceDictionary Source="../res/OrgChartTreeViewItemStyle.xaml"/>
                    </ResourceDictionary.MergedDictionaries>
                </ResourceDictionary>
            </TreeView.Resources>
			<TreeView.ItemContainerStyle>
				<Style TargetType="{x:Type TreeViewItem}">
					<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
					<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
					<Setter Property="FontWeight" Value="Normal" />
					<Style.Triggers>
						<Trigger Property="IsSelected" Value="True">
							<Setter Property="FontWeight" Value="Bold" />
						</Trigger>
					</Style.Triggers>
				</Style>
			</TreeView.ItemContainerStyle>
			<TreeView.ItemTemplate>
				<HierarchicalDataTemplate ItemsSource="{Binding Children}">
					<TextBlock Text="{Binding Name}" />
				</HierarchicalDataTemplate>
			</TreeView.ItemTemplate>
		</TreeView>
	</DockPanel>
</UserControl>
